package com.zhudeshuai.zhudemolist.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;

import com.zhu.zhuCore.log.Logger;


/**
 * @author zhudeshuai
 * @since 16/5/29
 */
public class CustomerViewOne extends LinearLayout {

	private static final String TAG = "CustomerTouch";

	private Logger mLogger = new Logger(TAG);

	public CustomerViewOne(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	protected void onLayout(boolean changed, int l, int t, int r, int b) {
		super.onLayout(changed, l, t, r, b);
	}


	@Override
	public boolean onTouchEvent(MotionEvent event) {


		mLogger.d(TAG, this.getClass().getSimpleName() + " : onTouchEvent," + getAction(event));
		return super.onTouchEvent(event);
	}

	private String getAction(MotionEvent event) {
		String resultAction = "";
		switch (event.getAction()) {
			case MotionEvent.ACTION_DOWN:
				resultAction = "ACTION_DOWN";
				break;
			case MotionEvent.ACTION_MOVE:
				resultAction = "ACTION_MOVE";
				break;
			case MotionEvent.ACTION_UP:
				resultAction = "ACTION_UP";
				break;
		}
		return resultAction;
	}

	@Override
	public boolean onInterceptTouchEvent(MotionEvent event) {
		mLogger.d(TAG, this.getClass().getSimpleName() + " : onInterceptTouchEvent," + getAction(event));
		return super.onInterceptTouchEvent(event);
	}

	@Override
	public boolean dispatchTouchEvent(MotionEvent event) {
		mLogger.d(TAG, this.getClass().getSimpleName() + " : dispatchTouchEvent," + getAction(event));
		return super.dispatchTouchEvent(event);
	}
}
